<?php
declare(strict_types=1);

namespace app\common\model\delivery;

use think\Model;

class DriverPosition Extends Model
{
    public static function add($drivers,$latitude,$longitude)
    {
        foreach($drivers as $driver){
            $position=new self();
            $position->channel_id=$driver->channel_id;
            $position->driver_id=$driver->id;
            $position->latitude=$latitude;
            $position->longitude=$longitude;
            $position->createtime=time();
            $position->save();
        }
    }

    public function driver()
    {
        return $this->hasOne(Driver::class,'id','driver_id');
    }
}
